﻿using ControlLibrary.Controls;
using System.Diagnostics;
using System.Windows;

namespace MessageHostDemo
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            DataContext = this;
        }

        public MessageHostQueue MessageQueue { get; } = new MessageHostQueue();

        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            MessageQueue.Default($"测试消息111--{DateTime.Now}");
        }

        private void Button_Click_2(object sender, RoutedEventArgs e)
        {
            MessageQueue.Success($"测试消息111--{DateTime.Now}");
        }

        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            MessageQueue.Warning($"测试消息111--{DateTime.Now}");
        }

        private void Button_Click_4(object sender, RoutedEventArgs e)
        {
            //_ = Task.Factory.StartNew(() =>
            //{
            //    for (var i = 0; i < 100; i++)
            //    {
            //        var cts = new CancellationTokenSource(TimeSpan.FromSeconds(5));
            //         cts.Token.Register(() => Debug.WriteLine("11")).Dispose();


            //    }
            //});
            MessageQueue.Error($"测试消息111--{DateTime.Now}");
        }
    }
}